class Rainbow
	include Enumerable
	def each
		yield "red"
		yield "orange"
		yield "yellow"
		yield "green"
		yield "blue"
		yield "indigo"
		yield "violet"
	end
end

r= Rainbow.new
r.each do |color|
	puts "Next color: #{color}"
end
y_color = r.find {|color| color.start_with?('y')}
puts "First color starting with 'y' is #{y_color}."

r = Range.new(1,10)
puts r.one? {|n| n == 5}
puts r.none? {|n| n % 2 == 0}
puts r.any? {|n| n > 5}
puts r.include?(7)
puts r.all?{|n| n > 0 }

#find
puts [1,2,3,4,5,6,7,8,9,10].find {|n| n > 5}
puts "----------------------------"
r = Rainbow.new 
puts r.select {|color| color.size == 6}
puts "----------------------------"
puts r.map {|color| color[0,3]}
puts "----------------------------"
puts r.drop_while {|color| color.size < 5}
puts "----------------------------"

a = [1,2,3,4,5,6,7,8,9,10]
puts a.find_all {|item| item > 5}

puts a.select {|item| item > 100}
puts a. reject {|item| item > 5}
#error
r = Range.new(1.0,10.0)
r.one? {|n| n == 5.0}
r = Range.new(1,10.3)